<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>龙翔收银系统</title>

<link href="css/jquery.bxslider.css" rel="stylesheet" type="text/css">
<link href="css/font-awesome.css" rel="stylesheet" />
<link href="css/index.css" rel="stylesheet" />

<style type="text/css">
.shouyin {
	width: 99%;
	height: 400px;
	background-color: background-color:#FAF7F7;;
	margin-left: 10px;
}

.shouyin .left {
	width: 70%;
	height: 400px;
	float: left;
	background-color: #fff;
}

.shouyin .right {
	width: 28%;
	height: 400px;
	float: left;
}
</style>
</head>
<body>
	<div class="mainlayout">


		<!-- 财务处理内容 -->
		<div class="r_financial_management">
			<!-- 陆金所网银文件处理 -->
			<ul class="hides">
				<li>

					<div class="shouyin">
						<div class="left">

							<!-- 陆金所网银文件处理查询后内容 -->
							<div>
								<table cellspacing="0" cellpadding="4" class="banking_processing_con">

									<tr>
										<td colspan="3" class="table_tdheight"><span>菜色项目 </span></td>

									</tr>

									<tr>
										<td width="2"></td>
										<td align="center" valign="top">
											<table class="banking_processing_con_tit" border="0" class="table_1" cellspacing="0" cellpadding="4">
												<tr align="center">
													<th align="center">助记编号</th>
													<th align="center">菜名</th>
													<th align="center">拼音码</th>
													<th align="center">单价</th>
													<th align="center">单位</th>
													<th align="center">类别</th>
												</tr>
												<!--start-->
												
												<tr class="tr_addcolor" id="">
												
												</tr>
												<!--end-->

											
											</table>
										</td>
										<td width="2"></td>
									</tr>
								</table>
								<table id="d" class="banking_processing_con_tit" border="0" class="table_1" cellspacing="0" cellpadding="4">
											<tr align="center"></tr>
											<tr class="tr_addcolor" >
													<td align="center"></td>
													</tr>
													
													</table>

							</div>
						</div>
						<div class="right">

							<table cellspacing="0" cellpadding="4" class="banking_processing_con">

								<tr>
									<td colspan="3" class="table_tdheight"><span>点菜 </span></td>
								</tr>

							</table>

  <form action="<%=path %>/cashiers/cashiers_addupSell" method="post" id="form" >
							<table class="banking_processing_tit">
							
								<tr height="15">

									<td colspan="5" align="center" >(拼音码)：
									 <input  id="name" type="txt" onkeyup="soso()" style=" width: 60%;font-size: 30">
									 <p id="mess" style="color: red;" ></p>
									</td>

									<script src="js/jquery-1.10.2.js"></script>
									<script type="text/javascript">
					
								function soso(){
								
								 var name=document.getElementById("name").value;
								  var s="2";
				     
                                   $.ajax({  
                                          type: 'post',  
                                          url: 'cashiers/cashiers_findSellSort',
                                          data:"sell.name="+name+"&s="+s,  
                                          dataType: 'text',  
                                         success: function(data){
                                            var tableStr ="";           
                               var jsonObj=eval("("+data+")");  
                           $.each(jsonObj, function (i, item) {  
                           
                            tableStr = tableStr + "<tr class='tr_addcolor' ><td align='center'>"+ item.codeid +"</td>"
                            + "<td align='center'>"+ item.name +"</td>"
                            + "<td align='center'>"+ item.code +"</td>"
                            + "<td align='center'>"+ item.price +"</td>"
                            +"<td align='center'>"+item.unit + "</td>"
                             + "<td align='center'>"+ item.category +"</td></tr>"; 
                            $("#a").val(item.price);
                             $("#id").val(item.codeid);
                             $("#shellname").val(item.name); 
                             $("#code").val(item.code);
                              $("#price").val(item.price); 
                             $("#unit").val(item.unit); 
                              $("#category").val(item.category); 
                                                         
                                   $("#d").html(tableStr);  
                                 });  
                              
                             
     
                           },  
                                 error: function(text) {
                                
                                  }  
                             });  
                             }
                                          </script>
									<td></td>

								</tr>
								<tr>
									<td ></td>
									<td >份数:</td>
									<td style="text-align:left"><input id="fen"  value="1" type="txt" style=" font-size:15;width: 80%;"></td>
                                    <td>两:</td>
                                    <td style="text-align:left"><input id="liang"  value="1" type="txt" style=" font-size:15;width: 40%;"></td>
                                   
								</tr>
								<tr>

									<td colspan="5" align="center">

										<table class="banking_processing_con_tit" border="0" class="table_1" cellspacing="0" cellpadding="4">

											<!--start-->
											<tr class="tr_addcolor">
												<s:iterator id="g" value="#request.orderlist">
													<th align="center" >
													<s:property value="#g.name" /> 
													<select   name="order" style="10%">
													
												<option value="<s:property value="#g.name" />|<s:property value="#g.price" />"><s:property value="#g.price" /></option>
															
													</select></th>
												</s:iterator>
												<input id="orders" type="text"  value="" style="width: 100%">
													
                                                <script src="js/jquery-1.10.2.js"></script>
									<script type="text/javascript">
						$(function(){	
						
					 $("select").click(function(){
					
					 var or = this.options[this.selectedIndex].text;
					
					  $("#a").val(parseFloat( $("#a").val())+parseFloat(or));
						$("#orders").val($("#orders").val()+" "+this.options[this.selectedIndex].value);
							$("#remarks").val($("#orders").val());		
					 });
					 
					 $("#orders").keyup(function () {
					 $("#remarks").val($("#orders").val());	
					 
					 });
					 $("#fen").keyup(function () {
					  $("#a").val( parseFloat( $("#a").val())*parseInt($("#fen").val()));
					 });
					 $("#liang").keyup(function () {
					  $("#a").val( parseFloat( $("#a").val())+(parseInt($("#liang").val())-1)*0.5);
					  
					 
					 });
					  $("#shi").keyup(function () {
					  $("#sum").val( parseFloat( parseInt($("#shi").val())-$("#a").val()));
					 
					 });

                });
						</script>
												<!--end-->

											</tr>

										</table>
									</td>
								</tr>

                                 
								<tr><s:if test="#session.sum==null">
									<td style="width: 30%">小计:<i ><input id ="a" name="" value="0" disabled="disabled" style="color:#F00; font-size:25px;width: 60;">元</i>
									</s:if><s:else>
									<td style="width: 30%">小计:<i ><input id ="a" name="" value="<s:property value="#session.sum"/>" disabled="disabled" style="color:#F00; font-size:25px;width: 60;">元</i>
									
									</s:else>
									</td>
									<td style="width:50px">实收:</td>
									<td colspan="5" style="text-align:left;"><input id="shi" type="txt" value="0" style=" font-size:25px;width: 35%;">
									 找余:<i ><input id ="sum" value="0"  disabled="disabled" style="color:#F00; font-size:25px;width: 80;">元</i>
								</tr>
								 <tr>
									<td colspan="6">
									
								     <input name="sell.codeid" id="id" type="hidden" >
								      <input name="sell.name" id="shellname" type="hidden" >
								       <input name="sell.code" id="code" type="hidden" >
								        <input name="sell.unit" id="unit" type="hidden">
								        <input name="sell.price" id="price" type="hidden" >
								        <input name="sell.total" id="total" type="hidden" >
								         <input name="sell.category" id="category" type="hidden">
								          <input name="sell.count" id="count" type="hidden">
								           <input name="sell.liang" id="sellliang" type="hidden" >
									<input name="sell.remarks" id="remarks" type="hidden">
									 <input  type="submit" class="buttonstyle" value="添加">
									 <a href="<%=path %>/cashiers/cashiers_addupSell?s=add" id="add"><input name="add"  type="button" class="buttonstyle" value="结账"></a></td>
									<script src="js/jquery-1.10.2.js"></script>
									<script type="text/javascript">
						$(function(){	
						$("#add").click(function(){
						
						if($("#to").val()==""||$("#to").val()==null){
						$("#mess").html("请输入正确的菜品");
						return false;
						}else{
						
						return true;
						}
						
						});
					 $("#form").submit(function(){
					  $("#count").val(parseInt($("#fen").val()));
					  $("#total").val(parseFloat($("#a").val()));
					  $("#sellliang").val(parseInt($("#liang").val()));
					 if($("#name").val()==""||$("#name").val()==null||$("#id").val()==""||$("#id").val()==null){
					 $("#mess").html("请输入正确的菜品");
					 return false;
					 }else{ 
					
						return true;
						}
						
					 		
					 });
					 
					

                });
						</script>
									 
									 
								
								</tr>
								
							</table>
							</form>
							<div></div>
						</div>
					</div> <!-- 文件处理查询后内容 -->
					<div>
						<table cellspacing="0" cellpadding="4" class="banking_processing_con">
							<tr>
								<td colspan="3" class="table_tdheight"><span>点菜详情 </span></td>
							</tr>
							<tr>
								<td width="2"></td>
								<td align="center" valign="top">
									<form name="detailForm" method="post">
										<table border="0" class="banking_processing_con_tit" cellspacing="0" cellpadding="4">
											<tr align="center">

												<th align="center">编号</th>
												<th align="center">商品编号</th>
												<th align="center">菜名</th>
												<th align="center">拼音码</th>
												<th align="center">单价</th>
												<th align="center">单位</th>
												<th align="center">数量</th>
												<th align="center ">两</th>
												<th align="center">小计</th>
												<th align="center" style="width:30%;">加菜</th>
												
												<th align="center">操作</th>
											</tr>
											<s:iterator id="s" value="#session.list">
											<tr class="tr_addcolor">
											<td align="center"><s:property value="#s.id"/></td>
											<td align="center"><s:property value="#s.codeid"/></td>
											<td align="center"><s:property value="#s.name"/></td>
											<td align="center"><s:property value="#s.code"/></td>
											<td align="center"><s:property value="#s.price"/></td>
											<td align="center"><s:property value="#s.unit"/></td>
											<td align="center"><s:property value="#s.count"/></td>
											<td align="center"><s:property value="#s.liang"/></td>
											<td align="center"><s:property value="#s.total"/></td>
											<td align="center"><s:property value="#s.remarks"/></td>
											<td align="center"><a href="<%=path %>/cashiers/cashiers_deleteSell?sell.id=<s:property value="#s.id"/>">取消</a></td>
											
											</tr>
											</s:iterator>
											<tr class="tr_addcolor">
												<td class="td_3" align="center" colspan="8">
												<font color="#A63E19">总价：</font><i ><s:property value="#session.sum"/>
												<input type="hidden" id="to" value="<s:property value="#session.sum"/>">
												</i></td>
											</tr>
											
										</table>
									</form>
								</td>
								<td width="2"></td>
							</tr>
							<tr height="15">
								<td colspan="3">&nbsp;</td>
							</tr>

						</table>

					</div>
				</li>
			</ul>
		</div>
		<script src="../js/jquery-1.10.2.js"></script>
		<script src="../js/pagination.js"></script>
		<script type="text/javascript" src="../js/jquery.bxslider.js"></script>
		<script type="text/javascript" src="../js/adddate.js"></script>
		<script src="../js/jquery.contextmenu.r2.js"></script>
		<script src="../js/style.js"></script>
	</div>

</body>
</html>
